﻿<UserControl
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:local="clr-namespace:ToolBar.Views" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" x:Class="ToolBar.Views.ToolBarView" 
             mc:Ignorable="d" 
             d:DesignHeight="77" d:DesignWidth="575">
	<UserControl.Resources>
		<DataTemplate x:Key="MenuDataTemplate">
			<StackPanel Orientation="Horizontal">
				<Border Padding="0">
					<StackPanel Orientation="Horizontal">
						<TextBlock Text="{Binding DisplayName}"/>
					</StackPanel>
				</Border>
			</StackPanel>             
		</DataTemplate>
	</UserControl.Resources>
    <Grid>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="30.03"/>
    		<RowDefinition/>
    	</Grid.RowDefinitions>
    	<Grid.DataContext>
    		<local:DummyToolBarViewModel/>
    	</Grid.DataContext>
    	<ToolBar d:LayoutOverrides="Height" Grid.Row="1"/>
            
    	<ig:XamMenu ItemsSource="{Binding MenuItems}" ItemTemplate="{StaticResource MenuDataTemplate}">    		    		    		
    		<ig:XamMenu.HierarchicalItemTemplate>
    			<ig:HierarchicalDataTemplate ItemTemplate="{StaticResource MenuDataTemplate}" ItemsSource="{Binding Children}">    				
    				<ig:HierarchicalDataTemplate.DefaultItemsContainer>
    					<DataTemplate>
    						<ig:XamMenuItem>
    							<ig:XamMenuItem.Icon>
    								<Image Source="{Binding ImageURL}"/>			
    							</ig:XamMenuItem.Icon>
								<i:Interaction.Triggers>
					    			<i:EventTrigger EventName="Click">
					    				<i:InvokeCommandAction Command="{Binding Path=DataContext.MenuSwitchPageCommand,RelativeSource={RelativeSource AncestorType={x:Type ig:XamMenu}}}" CommandParameter="{Binding DisplayName}"/>
					    			</i:EventTrigger>
					    		</i:Interaction.Triggers>
    						</ig:XamMenuItem>			
    					</DataTemplate>			
    				</ig:HierarchicalDataTemplate.DefaultItemsContainer>
    			</ig:HierarchicalDataTemplate> 		
    		</ig:XamMenu.HierarchicalItemTemplate>    		
    	</ig:XamMenu>
            
    </Grid>
</UserControl>
